package Chapter6.entity;

import java.beans.Transient;
import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name = "Customer", uniqueConstraints = { @UniqueConstraint(columnNames = "name") })
@SecondaryTable(name = "Customer_detail", pkJoinColumns = @PrimaryKeyJoinColumn(name = "name"))
public class Customer implements Serializable {
	private static final long serialVersionUID = 1L;
	private long id;
	private String name;
	private String address;
	private Double age;

	public Customer(String name, String address, Double age) {
		this.name = name;
		this.address = address;
		this.age = age;
	}

	public Customer() {
	}

	@Id
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "customer_detail", table = "Customer_detail")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(precision = 1)
	public Double getAge() {
		return age;
	}

	public void setAge(Double age) {
		this.age = age;
	}

}
